from django.shortcuts import render,HttpResponse

from lilun.models import Lilun,LilunForm

# Create your views here.
def saveLilun(request):
    import os
    liluns = os.listdir(r'C:\Users\gao10\Desktop\readExams\lilun\templates\lilun')
    for i in liluns:
        name = i
        content = r'lilun\\' + i
        Lilun(name=name,content=content).save()
    return HttpResponse('success')

def showLilun(request):
    get = request.GET
    id = int(get.get('id','15').strip())
    print('lilun/' + Lilun.objects.filter(id=int(id))[0].content)
    return render(request,Lilun.objects.filter(id=int(id))[0].content,locals())
    # return HttpResponse('success')

